package com.threeti.mecool.core.application.init;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.threeti.mecool.core.application.basicdata.BasicDataSyncService;
import com.threeti.mecool.core.domain.model.plan.pojo.Job;
import com.threeti.mecool.core.domain.model.plan.pojo.Step;
import com.threeti.mecool.core.domain.model.plan.pojo.StepItem;
import com.threeti.mecool.core.domain.model.plan.pojo.Task;
import com.threeti.mecool.core.domain.model.plan.pojo.TaskAction;
import com.threeti.mecool.core.domain.model.plan.pojo.TaskActionDataType;
@Service
public class Initializer {
	@Autowired
	private BasicDataSyncService basicSyncService;
  
  @Transactional
	public void initializeChannelSync() {
  	basicSyncService.initializeChannelSync();
	}

  // 创建参考任务模板->
  /** 创建(参考)踩点办证任务 */
  public static Job createFootPrintAndCertJob() {
    final String jobName = "踩点办证";
    Job job = Job.findByName(jobName);
    if (job != null)
      return job;
    // <editor-fold desc="prepare tasks">
    Task task_photoSelf = getTask(TaskAction.TAKE_PHOTO, "督导自拍");
    Task task_checkStoreAddress = getStoreAddressTask();
    Task task_photoStoreFar = getTask(TaskAction.TAKE_PHOTO, "门店远景");
    Task task_photoStoreNear = getTask(TaskAction.TAKE_PHOTO, "门头照");
    Task task_inputStoreAddress = getTask(TaskAction.INPUT_TEXT, "输入门店地址", TaskActionDataType.CODE_INPUT_STORE_ADDRESS);
    Task task_inputOthers = getTask(TaskAction.INPUT_TEXT, "其他-督导手工填写");
    Task task_invalidStoreAddress = getInvalidStoreAddressTask();
    Task task_contact = getContactTask();
    Task task_contactName = getTask(TaskAction.INPUT_TEXT, "联系人-姓名", TaskActionDataType.CODE_INPUT_CONTACT_NAME);
    Task task_contactPosition = getTask(TaskAction.INPUT_TEXT, "联系人-职位", TaskActionDataType.CODE_INPUT_CONTACT_POSITION);
    Task task_contactMobile = getTask(TaskAction.INPUT_TEXT, "联系人-联系方式", TaskActionDataType.CODE_INPUT_CONTACT_WAY);
    Task task_noContact = getNoContactTask();
    Task task_photoGoods = getTask(TaskAction.TAKE_PHOTO, "陈列照");
    Task task_photoGoodsSpecial = getTask(TaskAction.TAKE_PHOTO, "特殊陈列照");
    Task task_finish = getTask(TaskAction.FINISH, "完成任务");
    Task task_sales = getSalesTask();
    Task task_noSales = getNoSalesTask();
    Task task_cert = getCertTask();
    Task task_noCert = getNoCertTask();
    Task task_certFee = getCertFeeTask();
    Task task_inputCertFee = getTask(TaskAction.INPUT_NUMBER, "办证费用");
    // </editor-fold>
    job = new Job();
    job.setName(jobName);
    // <editor-fold desc="督导自拍">
    job.createStep(task_photoSelf, "督导自拍", true);
    // </editor-fold>
    // <editor-fold desc="检查门店地址">
    Step step_checkStoreAddress = job.createStep(task_checkStoreAddress, "检查门店地址");
    // <editor-fold desc="check store address - yes">
    StepItem checkStoreAddress_yes = step_checkStoreAddress.getStepItems().get(0);
    checkStoreAddress_yes.createStep(task_photoStoreFar, "门店远景");
    checkStoreAddress_yes.createStep(task_photoStoreNear, "门头照");
    // </editor-fold>
    // <editor-fold desc="check store address - no">
    StepItem checkStoreAddress_no = step_checkStoreAddress.getStepItems().get(1);
    Step step_invalidStoreAddress = checkStoreAddress_no.createStep(task_invalidStoreAddress, "选择门店地址不正确原因");
    StepItem invalidStoreAddress_not_exist = step_invalidStoreAddress.getStepItems().get(0);
    invalidStoreAddress_not_exist.createStep(task_photoStoreFar, "门店远景");
    invalidStoreAddress_not_exist.createStep(task_photoStoreNear, "门头照");
    StepItem invalidStoreAddress_wrong = step_invalidStoreAddress.getStepItems().get(1);
    invalidStoreAddress_wrong.createStep(task_photoStoreFar, "门店远景");
    invalidStoreAddress_wrong.createStep(task_photoStoreNear, "门头照");
    invalidStoreAddress_wrong.createStep(task_inputStoreAddress, "输入正确的门店地址");
    StepItem invalidStoreAddress_closed = step_invalidStoreAddress.getStepItems().get(2);
    StepItem invalidStoreAddress_other = step_invalidStoreAddress.getStepItems().get(3);
    invalidStoreAddress_other.createStep(task_inputOthers, "门店地址错误原因");
    // </editor-fold>
    // <editor-fold desc="check store address - empty">
    StepItem checkStoreAddress_empty = step_checkStoreAddress.getStepItems().get(2);
    checkStoreAddress_empty.createStep(task_photoStoreFar, "门店远景");
    checkStoreAddress_empty.createStep(task_photoStoreNear, "门头照");
    checkStoreAddress_empty.createStep(task_inputStoreAddress, "输入正确的门店地址");
    // </editor-fold>
    // </editor-fold>
    // <editor-fold desc="输入门店联系人">
    Step step_contact = job.createStep(task_contact, "输入门店联系人");
    // <editor-fold desc="contact - yes">
    StepItem contact_yes = step_contact.getStepItems().get(0);
    contact_yes.createStep(task_contactName, "姓名");
    contact_yes.createStep(task_contactPosition, "职位");
    contact_yes.createStep(task_contactMobile, "联系方式");
    // </editor-fold>
    // <editor-fold desc="contact - no">
    StepItem contact_no = step_contact.getStepItems().get(1);
    Step step_noContact = contact_no.createStep(task_noContact, "未找到联系人原因");
    step_noContact.getStepItems().get(2).createStep(task_inputOthers, "未找到联系人原因");
    // </editor-fold>
    // </editor-fold>
    // <editor-fold desc="办证">
    Step step_cert = job.createStep(task_cert, "是否完成办证");
    // <editor-fold desc="cert - yes">
    StepItem yesCert = step_cert.getStepItems().get(0);
    // <editor-fold desc="确认办证费用">
    Step step_certFee = yesCert.createStep(task_certFee, "确认办证费用");
    step_certFee.getStepItems().get(0).createStep(task_inputCertFee, "输入办证费用");
    step_certFee.getStepItems().get(1).createStep(task_inputOthers, "未完成办证费用原因");
    // </editor-fold>
    // </editor-fold>
    // <editor-fold desc="cert - no">
    StepItem noCert = step_cert.getStepItems().get(1);
    Step step_noCert = noCert.createStep(task_noCert, "未完成办证原因");
    step_noCert.getStepItems().get(4).createStep(task_inputOthers, "未完成办证原因");
    // </editor-fold>
    // </editor-fold>
    // <editor-fold desc="拍排面陈列照片">
    job.createStep(task_photoGoods, "考察店内排面，拍排面陈列照片");
    // </editor-fold>
    // <editor-fold desc="拍排面特殊陈列照片">
    job.createStep(task_photoGoodsSpecial, "考察店内特殊排面，拍排面特殊陈列照片");
    // </editor-fold>
    // <editor-fold desc="店内长促交流">
    Step step_sales = job.createStep(task_sales, "店内长促交流");
    StepItem sales_no = step_sales.getStepItems().get(1);
    Step step_noSales = sales_no.createStep(task_noSales, "未完成长促交流原因");
    step_noSales.getStepItems().get(3).createStep(task_inputOthers, "未完成长促交流原因");
    // </editor-fold>
    // <editor-fold desc="离店门头照">
    job.createStep(task_photoStoreNear, "离店时，再次拍门店门头照一张");
    // </editor-fold>
    // <editor-fold desc="完成任务">
    job.createStep(task_finish, "完成任务");
    // </editor-fold>
    job.save();
    return job;
  }

  /** 创建(参考)开店任务 */
  public static Job createOpenStoreJob() {
    final String jobName = "开店";
    final String jobCode = Job.CODE_JOB_STORE_OPENING;
    Job job = Job.findByCode(jobCode);
    if (job != null)
      return job;
    // <editor-fold desc="prepare tasks">
    Task task_photoSelf = getTask(TaskAction.TAKE_PHOTO, "督导自拍");
    Task task_photoStoreFar = getTask(TaskAction.TAKE_PHOTO, "门店远景");
    Task task_photoStoreNear = getTask(TaskAction.TAKE_PHOTO, "门头照");
    Task task_confirmOpenStore = getConfirmOpenStoreTask();
    Task task_inputOthers = getTask(TaskAction.INPUT_TEXT, "其他-督导手工填写");
    Task task_photoGoods = getTask(TaskAction.TAKE_PHOTO, "陈列照");
    Task task_photoGoodsSpecial = getTask(TaskAction.TAKE_PHOTO, "特殊陈列照");
    Task task_finish = getTask(TaskAction.FINISH, "完成任务");
    Task task_photoOpenStore = getTask(TaskAction.TAKE_PHOTO, "开店现场");
    Task task_photoSales = getTask(TaskAction.TAKE_PHOTO, "促销员工作照");
    Task task_unfinishedOpenStore = getUnfinishedOpenStoreTask();
    // </editor-fold>
    job = new Job();
    job.setName(jobName);
    job.setCode(jobCode);
    // <editor-fold desc="督导自拍">
    job.createStep(task_photoSelf, "督导自拍", true);
    // </editor-fold>
    // <editor-fold desc="门店照片">
    job.createStep(task_photoStoreFar, "门店远景");
    job.createStep(task_photoStoreNear, "门头照", true);
    // </editor-fold>
    // <editor-fold desc="确认开店是否完成">
    Step step_confirmOpenStore = job.createStep(task_confirmOpenStore, "是否完成开店");
    // <editor-fold desc="confirm open store - yes">
    StepItem confirmOpenStore_yes = step_confirmOpenStore.getStepItems().get(0);
    confirmOpenStore_yes.createStep(task_photoOpenStore, "开店现场照");
    confirmOpenStore_yes.createStep(task_photoGoods, "排面陈列照");
    confirmOpenStore_yes.createStep(task_photoGoodsSpecial, "特殊陈列照", false, true);
    confirmOpenStore_yes.createStep(task_photoSales, "拍摄促销员工作照");
    // </editor-fold>
    // <editor-fold desc="confirm open store - no">
    StepItem confirmOpenStore_no = step_confirmOpenStore.getStepItems().get(1);
    Step step_unfinishedOpenStore = confirmOpenStore_no.createStep(task_unfinishedOpenStore, "未完成开店原因");
    StepItem unfinishedOpenStore_other = step_unfinishedOpenStore.getStepItems().get(3);
    unfinishedOpenStore_other.createStep(task_inputOthers, "输入未完成开店原因");
    // </editor-fold>
    // </editor-fold>
    // <editor-fold desc="离店门头照">
    job.createStep(task_photoStoreNear, "离店时，再次拍门店门头照一张", true);
    // </editor-fold>
    // <editor-fold desc="完成任务">
    job.createStep(task_finish, "完成任务", true);
    // </editor-fold>
    job.save();
    return job;
  }

  /** 创建(参考)巡店任务 */
  public static Job createPatrolJob() {
    final String jobName = "巡店";
    Job job = Job.findByName(jobName);
    if (job != null)
      return job;
    // <editor-fold desc="prepare tasks">
    Task task_photoSelf = getTask(TaskAction.TAKE_PHOTO, "督导自拍");
    Task task_photoStoreFar = getTask(TaskAction.TAKE_PHOTO, "门店远景");
    Task task_photoStoreNear = getTask(TaskAction.TAKE_PHOTO, "门头照");
    Task task_photoGoods = getTask(TaskAction.TAKE_PHOTO, "陈列照");
    Task task_photoGoodsSpecial = getTask(TaskAction.TAKE_PHOTO, "特殊陈列照");
    Task task_finish = getTask(TaskAction.FINISH, "完成任务");
    Task task_photoSales = getTask(TaskAction.TAKE_PHOTO, "促销员工作照");
    // </editor-fold>
    job = new Job();
    job.setName(jobName);
    job.createStep(task_photoSelf, "督导自拍", true);
    job.createStep(task_photoStoreFar, "门店远景");
    job.createStep(task_photoStoreNear, "门头照", true);
    job.createStep(task_photoGoods, "拍摄排面陈列照");
    job.createStep(task_photoGoodsSpecial, "拍摄特殊陈列照", false, true);
    job.createStep(task_photoSales, "拍摄促销员工作照");
    job.createStep(task_photoStoreNear, "离店时，再次拍门店门头照一张", true);
    job.createStep(task_finish, "完成任务", true);
    job.save();
    return job;
  }
  //<-


    public static Job createScoreJob() {
        final String name = "促销员评分";
        Job job = Job.findByName(name);
        if (job != null) {
            return job;
        }
        TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.ID_INPUT_MULTIPLE_SCORE, name);
        if (dataType == null) {
            dataType = new TaskActionDataType(TaskAction.ID_INPUT_MULTIPLE_SCORE, name);
            dataType.save();
        }
        Task task = Task.findByDataTypeId(dataType.getId());
        if (task == null) {
            task = new Task(TaskAction.ID_INPUT_MULTIPLE_SCORE, dataType.getId());
            task.createItem("主动迎接顾客", "A-Stopping", "15", "主动跟货架/堆头/专柜1米内的消费者打招呼、微笑问好 或 派发传单等");
            task.createItem("主动跟顾客沟通", "B-Holding", "5", "主动引导顾客进入推荐流程");
            task.createItem("使用标准高效沟通话述之：推荐介绍", "B-Holding", "20", "一句关注需求，两句产品介绍（产品的卖点：给消费者带来什么功效、好处）");
            task.createItem("熟练使用产品手册/演示工具/试用装向顾客介绍产品", "B-Holding", "20", "给顾客介绍产品时，有使用产品手册/演示工具/tester");
            task.createItem("能利用产品知识、品类知识解答消费者的疑问", "B-Holding", "10", "1) 能说出消费者目前所遇到的问题的成因所在； 2) 能说出不同产品的区别，并告知消费者适合的产品是什么");
            task.createItem("主动向顾客介绍促销活动", "C-Closing", "5", "当顾客犹豫时，主动向顾客介绍买赠活动或者促销装");
            task.createItem("使用标准高效沟通话述之：促成销售", "C-Closing", "10", "一句话促成成交/连带销售");
            task.createItem("精神饱满，站姿标准，不闲聊", "D-BaseRequirement", "5", "1) 精神饱满，处于随时迎接顾客的状态； 2) 站姿标准（不弯腰，无叉腰）； 3) 不与其它导购聊天");
            task.createItem("货架/堆头/专柜上有陈列品牌要求摆放的物资 (助销工具/促销信息)", "D-BaseRequirement", "5", "助销工具类：产品手册/演示工具/tester/货架贴；或 促销信息类：海报,易拉宝,立牌,商场海通,爆炸贴等");
            task.createItem("品牌的特别要求", "E-Custom", "5", "各品牌可以根据需要，加重相应的评分点");
            task.save();
        }
        job = new Job();
        job.setName(name);
        job.createStep(task, name, true);
        job.save();
        return job;
    }

    public static Job createAttachmentJob() {
        final String name = "上传附件";
        Job job = Job.findByName(name);
        if (job != null) {
            return job;
        }
        TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.ID_UPLOAD_ATTACHEMENT, name);
        if (dataType == null) {
            dataType = new TaskActionDataType(TaskAction.ID_UPLOAD_ATTACHEMENT, name);
            dataType.save();
        }
        Task task = Task.findByDataTypeId(dataType.getId());
        if (task == null) {
            task = new Task(TaskAction.ID_UPLOAD_ATTACHEMENT, dataType.getId());
            task.save();
        }
        job = new Job();
        job.setName(name);
        job.createStep(task, name, true);
        job.save();
        return job;
    }

  // 创建(参考)步骤项->
  public static Task getTask(TaskAction taskAction, String dataTypeName) {
    if (TaskAction.SELECT_SINGLE.equals(taskAction)) {
      throw new RuntimeException("create separate function instead");
    }
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(taskAction.getId(), dataTypeName);
    if (dataType == null) {
      dataType = new TaskActionDataType(taskAction.getId(), dataTypeName);
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(taskAction.getId(), dataType.getId());
      task.save();
    }
    return task;
  }
  public static Task getTask(TaskAction taskAction, String dataTypeName, String dataTypeCode) {
    if (TaskAction.SELECT_SINGLE.equals(taskAction)) {
      throw new RuntimeException("create separate function instead");
    }
    TaskActionDataType dataType = TaskActionDataType.findByCode(dataTypeCode);
    if (dataType == null) {
      dataType = new TaskActionDataType(taskAction.getId(), dataTypeName, dataTypeCode);
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(taskAction.getId(), dataType.getId());
      task.save();
    }
    return task;
  }

  public static Task getStoreAddressTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "反馈门店地址是否正确");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "反馈门店地址是否正确");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("正确");
      task.createItem("不正确");
      task.createItem("没有显示");
      task.save();
    }
    return task;
  }

  public static Task getInvalidStoreAddressTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "门店地址不正确原因");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "门店地址不正确原因");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("地址不存在");
      task.createItem("地址错误");
      task.createItem("门店未营业");
      task.createItem("其他");
      task.save();
    }
    return task;
  }

  public static Task getContactTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "是否找到门店联系人");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "是否找到门店联系人");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("是");
      task.createItem("否");
      task.save();
    }
    return task;
  }

  public static Task getNoContactTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "未找到联系人原因");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "未找到联系人原因");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("无法找到联系人");
      task.createItem("联系人不愿提供");
      task.createItem("其他");
      task.save();
    }
    return task;
  }

  public static Task getSalesTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "店内长促交流");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "店内长促交流");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("是");
      task.createItem("否");
      task.save();
    }
    return task;
  }

  public static Task getNoSalesTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "未完成长促交流原因");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "未完成长促交流原因");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("店内无长促");
      task.createItem("长促当天未上班");
      task.createItem("长促未在现场工作");
      task.createItem("其他");
      task.save();
    }
    return task;
  }

  public static Task getCertTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "是否完成办证");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "是否完成办证");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("是");
      task.createItem("否");
      task.save();
    }
    return task;
  }

  public static Task getNoCertTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "未完成办证原因");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "未完成办证原因");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("办证时间已过");
      task.createItem("办证资料过期");
      task.createItem("办证费用不足");
      task.createItem("无法联系到主管或主管不提供");
      task.createItem("其他");
      task.save();
    }
    return task;
  }

  public static Task getCertFeeTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "确认办证费用");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "确认办证费用");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("是");
      task.createItem("否");
      task.save();
    }
    return task;
  }

  public static Task getConfirmOpenStoreTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "是否完成开店");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "是否完成开店");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("完成");
      task.createItem("未完成");
      task.save();
    }
    return task;
  }

  public static Task getUnfinishedOpenStoreTask() {
    TaskActionDataType dataType = TaskActionDataType.findFirstByActionIdAndName(TaskAction.SELECT_SINGLE.getId(),
        "未完成开店原因");
    if (dataType == null) {
      dataType = new TaskActionDataType(TaskAction.SELECT_SINGLE.getId(), "未完成开店原因");
      dataType.save();
    }
    Task task = Task.findByDataTypeId(dataType.getId());
    if (task == null) {
      task = new Task(TaskAction.SELECT_SINGLE.getId(), dataType.getId());
      task.createItem("物料不到位");
      task.createItem("促销员临时放弃");
      task.createItem("门店临时检查");
      task.createItem("其他");
      task.save();
    }
    return task;
  }
  // <-
}
